﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.MSRS
{
    class Class1
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.Period > 0 && ppa.Period <( ppa.PolicyActing.PeriodActings.Count()-1))
            {
                da.Value = ppa.Amount * 0.05;
            }

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.Amount * 0.1;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.Amount * 3;

                if (ppa.Period == 0)
                {
                    da.Description = "如果第一年因为疾病身故，则无息退回已交保费："+ppa.TotalFee;
                }
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.TotalFee;

                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.InsurantStates.Contains("重疾"))
            {
                ppa.SchemePeriodActing.PolicyPeriodActings[0].Fee = 0;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                ppa.SchemePeriodActing.PolicyPeriodActings[0].Fee = 0;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            int endAge = ppa.PolicyActing.Policy.SelectedInsurancePeriod.Value;

            if (endAge == 80)
            {
                if (ppa.Age < 60)
                {
                    if ((ppa.Period + 1) % 2 == 0)
                    {
                        da.Value = ppa.Amount * 0.09;
                    }
                }
                else
                {
                    da.Value = ppa.Amount * 0.12;
                }
            }
            else
            {
                if ((ppa.Period + 1) % 2 == 0)
                {
                    da.Value = ppa.Amount * 0.09;
                }
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            int endAge = ppa.PolicyActing.Policy.SelectedInsurancePeriod.Value;

            if (endAge == 80)
            {
                if (ppa.Age == 70)
                {
                    da.Value = ppa.Amount;
                }
            }
            else
            {
                if (ppa.Age == 60)
                {
                    da.Value = ppa.Amount;
                }

            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period == ppa.PolicyActing.PeriodActings.Count() - 1)
            {
                da.Value = ppa.TotalFee;
            }

        }
    }
}
